package com.css.dzj.zfjg.modules.taskovertime;


import com.css.aq.server.service.BaseService;
import com.css.dzj.zfjg.common.util.Constant;
import com.css.dzj.zfjg.common.util.CvaConstants;
import com.css.dzj.zfjg.common.util.R;
import com.css.dzj.zfjg.modules.taskinfo.entity.JgLhjgRwsEntity;
import com.css.dzj.zfjg.modules.taskinfo.service.TaskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 认领超时提醒
 */
@RestController
@RequestMapping("/overtime")
public class ClaimTaskOvertime {

    @Autowired
    private TaskInfoService taskInfoService;

    @Autowired
    private BaseService baseService;

    public R claimOverTime(@RequestParam String taskNo) {
        try {
            JgLhjgRwsEntity lhjgRwsEntity = taskInfoService.findById(taskNo);
            lhjgRwsEntity.setTaskState(CvaConstants.SUB_TASK_URGE);
            taskInfoService.update(lhjgRwsEntity);
            baseService.logSuccess(3, "认领超时提醒成功", "2");
            return R.ok();
        } catch(Exception e) {
            e.printStackTrace();
            baseService.logFailed(3, "认领超时提醒失败", "2");
            return R.error(e.getMessage());
        }



    }
}
